<?php
namespace App\Common\Cla\Weixin\MiniProgram;

use App\Common as com;
use App\Common\Cla\Weixin\MiniProgram as nameMiniProgram;

class Auth extends nameMiniProgram\Base\OfConfig {

	/**
	 * @param string $code
	 * @return array
	 * @throws
	 */
	public function session( string $code ):array {
		$res = $this->getEasyObj()->auth->session( $code );
		if( isset( $res['errcode'] ) ){
			throw com\Lib\Err\Exception::makeOfNew( '获取失败，code：' . $res['errcode'], com\Lib\Err\Code::$sysAssertError );
		}
		//
		return $res;
	}

}
